<?php

namespace app\share\behavior;

class Cross
{
    public function appInit()
    {
        #暂时开启全局跨域, 后面可注销,nginx配置方向代理, 使其在同一个域名下
//        header('Access-Control-Allow-Origin:*');
//        header('Access-Control-Allow-Methods:*');
//        header('Access-Control-Allow-Headers:*');
//        header('Access-Control-Allow-Credentials:false');
        header('Access-Control-Allow-Origin: *');
        header("Access-Control-Allow-Headers: token, Origin, X-Requested-With, Content-Type, Accept, Authorization");
        header('Access-Control-Allow-Methods: POST,GET,PUT,DELETE,OPTIONS');
        header('Access-Control-Expose-Headers:token,secret');
        if(request()->isOptions()){
            exit();
        }
    }

}